package BookOperation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

public class FindBook implements IOperation{
    @Override
    public void work(BookList bookList) {
        int size = bookList.getUseSize();
        System.out.print("请输入书名:>");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0; i < size; i++) {
            Book book = bookList.getBook(i);
            if (name.equals(book.getBookName())) {
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有此书");
    }
}
